/**
 * Route Mappings
 * (sails.config.routes)
 *
 * Your routes map URLs to views and controllers.
 *
 * If Sails receives a URL that doesn't match any of the routes below,
 * it will check for matching files (images, scripts, stylesheets, etc.)
 * in your assets directory.  e.g. `http://localhost:1337/images/foo.jpg`
 * might match an image file: `/assets/images/foo.jpg`
 *
 * Finally, if those don't match either, the default 404 handler is triggered.
 * See `api/responses/notFound.js` to adjust your app's 404 logic.
 *
 * Note: Sails doesn't ACTUALLY serve stuff from `assets`-- the default Gruntfile in Sails copies
 * flat files from `assets` to `.tmp/public`.  This allows you to do things like compile LESS or
 * CoffeeScript for the front-end.
 *
 * For more information on configuring custom routes, check out:
 * http://sailsjs.org/#!/documentation/concepts/Routes/RouteTargetSyntax.html
 */

module.exports.routes = {

  /***************************************************************************
  *                                                                          *
  * Make the view located at `views/homepage.ejs` (or `views/homepage.jade`, *
  * etc. depending on your default view engine) your home page.              *
  *                                                                          *
  * (Alternatively, remove this and add an `index.html` file in your         *
  * `assets` directory)                                                      *
  *                                                                          *
  ***************************************************************************/

  'get /': 'HomeController.index',

  'get /login': 'HomeController.login',

  'get /list': 'HomeController.list',

  'get /categories/': 'ListController.getCat',

  'get /product_list/:catName': 'HomeController.productList',

  'get /product/featured/hot': 'HomeController.productHot',

  'get /product/featured/new': 'HomeController.productNew',

  'get /product/featured/special': 'HomeController.productSpecial',

  'get /product/featured/free_shipping': 'HomeController.freeShipping',

  'get /products/:sn': 'HomeController.productDetail',

  'get /cart': 'UserController.cart',

  'post /users/cart/': 'UserController.addToCart',

  'put /users/cart/': 'UserController.modifyCart',

  'delete /users/cart/:sn/': 'UserController.deleteCart',

  'post /orders/': 'UserController.preOrder',

  'get /order_confirm/:id': 'UserController.order',

  'get /users/address': 'UserController.address',

  'post /users/address/': 'UserController.addAddress',

  'get /user/order/address/': 'UserController.confirmAddress',

  'post /users/order/': 'UserController.createOrder',

  'get /users/account/orders/': 'UserController.myOrders',

  'get /api/users/orders/': 'UserController.getOrders',

  'get /api/account/orders/': 'UserController.orderInfo',

  'get /account': 'HomeController.account',

  'get /api/brands/': 'ListController.getBrandsByCat',

  'get /api/products/': 'ListController.getProductsByBrand',

  'get /api/product/': 'ListController.getProductInfo',

  'get /api/addresses/': 'UserController.getAddresses',

  'get /api/search/': 'HomeController.searchProduct',

  'get /search/': 'HomeController.search',

  'get /users/order/payment': 'UserController.confirmOrder',

  'get /users/upload_payment/': 'UserController.uploadPayment',

  'get /users/orders/:id': 'UserController.orderDetail',

  'post /api/jssdk/signature/': 'PaymentController.getSig',

  'post /payment/:order_id': 'PaymentController.royalpay',

  'post /payment/callback/:order_id': 'PaymentController.callback',

  'get /api/current_ex/': 'PaymentController.getEx',

  'get /transfer/:id': 'PaymentController.transfer',

  'post /api/product/classify/': 'AdminController.classify',

  'get /api/transfer/media/': 'PaymentController.downloadMedia',

  'post /api/order/:id/status/': 'PaymentController.orderStatus',

  'get /api/user/info/': 'UserController.userInfo',

  'post /bind_phone/': 'UserController.bindPhone',

  'get /user/address/': 'UserController.myAddress',

  'get /api/user/address/': 'UserController.allAddress',

  'get /api/user/:openid/cart/': 'UserController.getCart',

  'post /api/user/address/': 'UserController.addAddress',

  'put /api/user/address/:id': 'UserController.editAddress',

  'delete /api/user/address/:id': 'UserController.delAddress',

  'get /user/address/edit/': 'UserController.addressDetail',

  'get /user/address/add/': 'UserController.addressAdd',

  'get /user/account/contact/': 'UserController.contactUs',

  'get /api/featured_products/': 'HomeController.featuredProducts',

  'get /api/order/payment/': 'UserController.getPaymentStatus',

  'get /api/order/wmsid/': 'UserController.getWmsid',

  'get /api/order/spec/': 'UserController.getOrderSpec',
  // '/': 'HomeController.index',
  //
  // 'get /login/:name': 'HomeController.login',
  //
  // //'/register': 'HomeController.register',
  //
  // //'/logout': 'HomeController.logout',
  //
  // '/list': {
  //   view: 'list'
  // },
  //
  // '/user': 'UserController.index',
  //
  // 'post /user/addToCart': 'UserController.addToCart',
  //
  // //'post /users/:id/cart/':
  // //'get /users/:id/cart/':
  // //'delete /users/:uid/cart/:iid
  //
  //
  // 'post /user/deleteFromCart': 'UserController.deleteFromCart',
  //
  // '/cart': 'UserController.cartView',
  //
  // 'get /detail/:id': 'UserController.detail',
  //
  // '/user': 'UserController.index',
  //
  // '/user/order' : 'UserController.order',
  //
  // '/user/address' : 'UserController.address',
  //
  // 'get /user/editAddress/:id' : 'UserController.editAddress',
  //
  // 'post /user/addAddress': 'UserController.addAddress',
  //
  // 'get /user/getAddress/:id': 'UserController.getAddressById',
  //
  // 'get /user/delAddress/:id': 'UserController.delAddressById',
  //
  // '/Users': 'UserController.index',
  //
  // '/list': 'ListController.index',
  //
  // 'get /list/:id': 'ListController.cat',
  //
  // 'get /detail/:id': 'ListController.detail',
  //
  'get /admin': 'AdminController.index',

  'get /admin/login': {
    view: 'admin/login',
    locals: {
      layout: 'admin/layout_login',
    }
  },

  'post /admin/login': 'AdminController.login',

  'get /admin/order/all': 'AdminController.orderAll',

  'get /admin/product/all': 'AdminController.productAll',

  'get /admin/product/feature/': 'AdminController.featureProduct',

  'post /api/product/feature/': 'AdminController.featureIt',

  'get /api/products': 'AdminController.getAllProducts',

  'get /admin/product/classified': 'AdminController.classified',

  'get /api/product/classified/': 'AdminController.getClassify',

  'post /api/wechat/notify/': 'UserController.wechatNotify',

  'get /api/products/:cat_id/': 'HomeController.getProductsPagination',

  'get /api/orders/:id/shipping/': 'PaymentController.getOrderShipping',

  'get /orders/:id/shipping/': 'PaymentController.orderShipping',
  // 'get /access': 'HomeController.access',
  //
  // 'get /msg': 'HomeController.msg',
  //
  // //'get /admin/order/detail/:id': 'AdminController.orderDetail',
  //
  // 'get /admin/order/split/:id': 'AdminController.orderSplit',
  //
  // 'get /search': 'HomeController.searchProduct',
  //
  // 'post /user/addAddress': 'UserController.addAddress',
  //
  // 'get /user/getAddress': 'UserController.getAddress',
  //
  //
  // //获取品牌接口，get方法，传入类别id，如果是所有类别则传入all
  // 'get /product/tags/:catId': 'HomeController.getTags',
  //
  // //根据品牌获取产品，get方法，传入品牌名
  // 'get /product/brand/:catId/:brandName': 'HomeController.getProductsByBrand',
  //
  // 'get /admin/product/featuredBrand': {view: 'admin/featured_brand', locals: {layout: 'admin/layout'}},
  //
  // 'get /admin/product/featured/:brand': 'AdminController.featuredBrand',
  //
  // 'get /admin/product/cancelFeatured/:brand': 'AdminController.cancelFeatured',
  //
  // 'get /product/featuredBrand': 'HomeController.getFeatured',
  //
  // 'get /getRate': 'HomeController.getRate',
  //
  // //'post /addOrderByCustomer': 'UserController.addOrderByCustomer',
  //
  // 'get /paymentMethod/:orderId': 'PaymentController.paymentMethod',
  //
  // 'post /addOrder': 'PaymentController.addOrder',
  //
  // 'get /getApiToken': 'HomeController.getApiToken',
  //
  // 'post /preOrder': 'HomeController.preOrder',
  //
  // 'post /testApi': 'HomeController.testOrderApi',
  //
  // 'get /testBox': 'HomeController.testBoxInfo',
  //
  // 'get /getBrandsByCat': 'HomeController.getBrandsByCat',
  //
  // 'get /allCats': 'HomeController.getAllCats',
  //
  // 'get /allBrands': 'HomeController.getAllBrands'




  /***************************************************************************
  *                                                                          *
  * Custom routes here...                                                    *
  *                                                                          *
  * If a request to a URL doesn't match any of the custom routes above, it   *
  * is matched against Sails route blueprints. See `config/blueprints.js`    *
  * for configuration options and examples.                                  *
  *                                                                          *
  ***************************************************************************/

};
